
using DG.Tweening;
using UnityEngine;

public class BaseWindow : MonoBehaviour
{
    public 开窗动画类型 动画类型;
    public string 开窗动画参数;
    public Animator animator;
    public CompDotween dotween参数;
    public Transform Bg;
    public int Layer;
    
    public virtual void OpenWindow()
    {
        switch (动画类型)
        {
            case 开窗动画类型.无:
                open();
                break;
            case 开窗动画类型.Animator:
                if (animator != null)
                {
                    animator.Play(开窗动画参数);
                }
                else
                {
                    open();
                }
                break;
            case 开窗动画类型.Dotween:
                dotween参数.播放(Bg,open);
                break;
        }
    }

    public virtual void 等待开窗Animator回调()
    {
        open();
    }
    protected void open()
    {
        gameObject.SetActive(true);
    }
    
    public virtual void CloseWindow()
    {
        gameObject.SetActive(false);
    }
}

public enum 开窗动画类型
{
    无,
    Animator,
    Dotween,
}

// public class BaseWindow<T> : BaseWindow
// {
//
// }
